package com.jsu.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.jsu.bean.FoundDetail;
import com.jsu.bean.FoundMessage;
import com.jsu.bean.LostDetail;
import com.jsu.bean.LostMessage;
import com.jsu.dao.FoundMapper;
import com.jsu.dao.FoundMessageMapper;
import com.jsu.dao.LostMapper;
import com.jsu.dao.LostMessageMapper;
@Component
public class RecieveLostService {

	@Autowired
	LostMapper lostMapper;
	@Autowired
	LostMessageMapper lostMessageMapper;
	
	public void recieveLost(LostDetail lostDetail){
		lostMapper.insertSelective(lostDetail.getLost());
		for(LostMessage lostMessage:lostDetail.getLostMessages()){
			lostMessage.setLost(lostDetail.getLost().getLostId());
			lostMessageMapper.insertSelective(lostMessage);
		}
	}
}
